/**
 * 
 */
package com.exject.android.socialphonebook.view;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.exject.android.socialphonebook.R;
import com.exject.android.socialphonebook.util.SendSMSUtil;

/**
 * http://www.google.de/url?sa=t&source=web&ct=res&cd=4&ved=0CCMQFjAD&url=http%3
 * A%2F%2Fmobiforge.com%2Fdeveloping%2Fstory%2Fsms-messaging-android&ei=38f
 * dS5WXCJ2iOIvQvIUH
 * &usg=AFQjCNFepsXl5Oh0meU5ViqIVeiSYKML-Q&sig2=wjt9HA1WCa07bXXQVJxTRQ Based on
 * <a href="http://mobiforge.com/developing/story/sms-messaging-android"
 * >http://mobiforge.com/developing/story/sms-messaging-android</a>
 * 
 * @author Benjamin Nagel <benjamin.nagel@stud.fh-dortmund.de>
 */
public class SendSMSActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.send_sms);
        
        final Button btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
        final EditText txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo);
        final EditText txtMessage = (EditText) findViewById(R.id.txtMessage);
        
        btnSendSMS.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                String phoneNo = txtPhoneNo.getText().toString();
                String message = txtMessage.getText().toString();
                if (phoneNo.length() > 0 && message.length() > 0) {
                    SendSMSUtil.sendSMS(SendSMSActivity.this, phoneNo, message);
                } else {
                    Toast.makeText(getBaseContext(),
                            "Please enter both phone number and message.",
                            Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
    
}
